#pragma once
//#include"list.h"


namespace zpl
{
	template<class iterator, class Ref, class Ptr>
	struct reverseiterator
	{
		typedef reverseiterator<iterator, Ref, Ptr> self;
		iterator cur;
		reverseiterator(iterator it)
			:cur(it)
		{}
		self& operator++()
		{
			--cur;
			return *this;
		}
		self operator++(int)
		{
			self tmp = *this;
			--cur;
			return tmp;
		}
		self& operator--()
		{
			++cur;
			return *this;
		}
		self operator--(int)
		{
			self tmp = *this;
			++cur;
			return tmp;
		}
		Ref operator*()
		{
			iterator tmp = cur;
			--tmp;
			return *tmp;
		}
		Ptr operator->()
		{
			iterator tmp = cur;
			--tmp;
			return &(*tmp);
		}
		bool operator==(const self& rit)
		{
			return cur == rit.cur;
		}
		bool operator!=(const self& rit)
		{
			return cur != rit.cur;
		}
	};
}
